//
//  KDLoginTool.m
//  WangJingApp
//
//  Created by 魏强 on 17/2/14.
//  Copyright © 2017年 KDTech. All rights reserved.
//

#import "KDLoginTool.h"
#import "KDBaseTool.h"
#import "KDUpdatePwdParam.h"
#import "KDUpdateImgParam.h"
@implementation KDLoginTool
+ (void)logoutWithParam:(KDBaseParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    KDAccount *account = [KDAccountTool account];
    NSString *url = [NSString stringWithFormat:@"%@%@%@",AuthServerAddr,@"user/loginout/",account.token];
    [KDBaseTool get:url param:nil resultClass:[KDBaseResult class] success:success failure:failure];
}
/**  获取用户信息 */
+ (void)getUserInfoWithParam:(KDBaseParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",AuthServerAddr,param.method];

    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];
}


+ (void)updatePwdWithParam:(KDUpdatePwdParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",AuthServerAddr,@"users/updatePwd"];
    [KDBaseTool put:url param:param resultClass:[KDBaseResult class] success:success failure:failure];
}

+ (void)updateImgWithParam:(KDUpdateImgParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",AuthServerAddr,@"users/image"];
    [KDBaseTool put:url param:param resultClass:[KDBaseResult class]
            success:success failure:failure];
}

/**  获取用户头像 */
+ (void)getUserAvatarWithParam:(KDUpdateImgParam *)param success:(void (^)(KDBaseResult *responseObejct))success failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@%@",AuthServerAddr,@"users/downloadImage"];
    
    [KDBaseTool get:url param:param resultClass:[KDBaseResult class] success:success failure:failure];

}
@end
